/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mumaker.spots;

import java.util.ArrayList;

/**
 *
 * @author Javs
 */
public class GestMob {

    private ArrayList<Mob> arrMob = new ArrayList<Mob>();
    private static GestMob INSTANCE = null;
    // Private constructor suppresses 

    private GestMob() {
       
    }

    // creador sincronizado para protegerse de posibles problemas  multi-hilo
    // otra prueba para evitar instanciación múltiple 
    private synchronized static void createInstance() {
        if (INSTANCE == null) {            
            INSTANCE = new GestMob();
        }
    }
    
    public static GestMob getInstance() {
        createInstance();
        return INSTANCE;
    }
    
    public void cargarNuevoMob(int nro, String nombre) {
        Mob m = new Mob(nombre, nro );
        this.arrMob.add(m);
    }   
    
    public ArrayList<Mob> retornarMob(){
        return this.arrMob;
    }
    public Mob retornarMob(int aux){
        for(Mob objM : this.arrMob){
            if(objM.getNumero() == aux){
                return objM;
            }      
        }
        return null;
    }
}
